$OpenBSD: patch-displaywrapper_cpp,v 1.1 2016/04/24 11:07:55 zhuk Exp $
--- displaywrapper.cpp.orig	Sun Apr 24 13:55:59 2016
+++ displaywrapper.cpp	Sun Apr 24 13:56:19 2016
@@ -280,8 +280,6 @@ void DisplayWrapper::dw_init(bool filter, int minWidth
   //short original_rate = XRRConfigCurrentRate(conf);
   //SizeID original_size_id = XRRConfigCurrentConfiguration(conf, &original_rotation);
 
-  XCloseDisplay(dpy);
-
   for (int i = 0; i < num_sizes; i++)
   {
     int width = xrrs[i].width;
@@ -300,6 +298,8 @@ void DisplayWrapper::dw_init(bool filter, int minWidth
       modes.append(mode);
     }
   }
+
+  XCloseDisplay(dpy);
 
   if (filter)
     modeNames.removeDuplicates();
